<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// 公共文件上传
Route::group(['prefix' => 'upload'], function(){
    // 文件上传
    Route::post('avatar', 'GeneralFileUpload@avatar');
});

Route::group([
    'namespace' => 'Api',
], function ($router) {
    // 注册
    Route::post('register', 'UserController@register');
    // 登录
    Route::post('login', 'AccController@login');

    Route::group([
        'middleware' => 'api_auth',
    ], function ($router) {
        // 退出登录
        Route::post('logout', 'AccController@logout');
        // 刷新token
        Route::post('refresh', 'AccController@refresh');
        // 我的信息
        Route::get('me', 'AccController@me');
    });
});
